package com.opgea.tutor.domain.entities;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.opgea.tutor.domain.qualifiers.PostStatus;

/**
 * Entity implementation class for Entity: Requirement
 * 
 */
@Entity
public class Post implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long id;
    private String heading;
    private String description;
    @Enumerated(EnumType.STRING)
    private PostStatus status;
    @Temporal(TemporalType.TIMESTAMP)
    private Date postedOn;
    @Temporal(TemporalType.TIMESTAMP)
    private Date closedOn;


    public Post() {
	super();
    }

    public long getId() {
	return id;
    }

    public void setId(long id) {
	this.id = id;
    }

    public String getHeading() {
	return heading;
    }

    public void setHeading(String heading) {
	this.heading = heading;
    }

    public String getDescription() {
	return description;
    }

    public void setDescription(String description) {
	this.description = description;
    }

    public PostStatus getStatus() {
	return status;
    }

    public void setStatus(PostStatus status) {
	this.status = status;
    }

    public Date getPostedOn() {
	return postedOn;
    }

    public void setPostedOn(Date postedOn) {
	this.postedOn = postedOn;
    }

    public Date getClosedOn() {
	return closedOn;
    }

    public void setClosedOn(Date closedOn) {
	this.closedOn = closedOn;
    }

    @Override
    public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result + ((heading == null) ? 0 : heading.hashCode());
	result = prime * result + (int) (id ^ (id >>> 32));
	return result;
    }

    @Override
    public boolean equals(Object obj) {
	if (this == obj)
	    return true;
	if (obj == null)
	    return false;
	if (getClass() != obj.getClass())
	    return false;
	Post other = (Post) obj;
	if (heading == null) {
	    if (other.heading != null)
		return false;
	} else if (!heading.equals(other.heading))
	    return false;
	if (id != other.id)
	    return false;
	return true;
    }

}
